/*
 * JaCoLiB
 * Copyright (C) 2008 Alessandro Serra
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */


package it.gashale.jacolib.main.configurator.scripts;

import it.gashale.jacolib.core.JacolibError;
import it.gashale.jacolib.main.Jacolib;
import it.gashale.jacolib.main.configurator.Configurator;

public class ShellServerConfigurator extends Configurator {
	public void configure(Jacolib jacolib) throws JacolibError {
		String name=getValue(new String[]{"Name"}, null);
		String port_str=getGlobalValue(new String[]{"Java","Port"}, null);
		port_str=getValue(new String[]{"Port"}, port_str);
		int port=Integer.parseInt(port_str);
		String password=getGlobalValue(new String[]{"Java","Password"}, null);
		password=getValue(new String[]{"Password"}, password);
		String ump_str=getGlobalValue(new String[]{"Java","Multi", "Threads", "P"}, null);
		ump_str=getValue(new String[]{"Multi", "Threads", "P"}, ump_str);
		boolean ump=ump_str.equals("true");
		jacolib.start_server(name,port, password, ump);
	}
}
